ImageStorageOffset

Adds the ability to get a pixel based upon its offset.

X and Y coordinate can be calculate using:

ImageStorage!Color image = ...;
size_t offset = ...;
size_t x = offset % image.height;
size_t y = offset / image.height;

Offset from X and Y coordinate can be calculated as:

ImageStorage!Color image = ...;
size_t x, y = ...;
size_t offset = x + (y * image.width);

Members

Functions

getPixelAtOffset
Color getPixelAtOffset(size_t offset)

Get a pixel given the position.

opIndex
Color opIndex(size_t offset)

Get a pixel given the position.

opIndex
Color opIndex(size_t offset)

Get a pixel given the position.

opIndexAssign
void opIndexAssign(Color value, size_t offset)

Set a pixel given the position.

setPixelAtOffset
void setPixelAtOffset(size_t offset, Color value)

Set a pixel given the position.

Properties

count
size_t count [@property getter]

The number of pixels in total

See Also

ImageStorage

Meta